package com.gitee.booting.idem4j.properties;

import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;

@Data
@ConfigurationProperties(prefix = Idem4jProperties.PREFIX)
public class Idem4jProperties {
    public static final String PREFIX = "idem4j";
    private Map<String, Control> mapping = new HashMap<>();
    private boolean failOnAbsent = true;
    private boolean allowUnofficial = false;
    private String token = "/api/v1/idem4j-token";
    private int expire = 3 * 60;

    @Data
    @Accessors(chain = true)
    public static class Control {
        private boolean failOnAbsent = false;
        private Supplier<String> generator;
    }
}
